package com.yh.dao;

import com.yh.javabean.Users;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface UsersDao {
    Users selectByUserName(String username);
    @Select("select * from users")
    @Results(id ="u_r",value = {
            @Result(id = true,column = "id",property = "id"),
            @Result(column = "id",property = "role",one=@One (select = "com.yh.dao.RoleDao.selectByUid",fetchType = FetchType.EAGER))
    }
    )
    List<Users> selectAll();
    int insertUsers(Users users);
}

